//
//  XXInt.swift
//  XXSwiftDemo
//
//  Created by admin on 2022/4/14.
//

import Foundation

prefix operator ~>
prefix operator ~>=
prefix operator ~<
prefix operator ~<=
prefix func ~>(_ i:Int) -> ((Int) -> Bool){ {$0>i} }
prefix func ~>=(_ i:Int) -> ((Int) -> Bool){ {$0>=i} }
prefix func ~<(_ i:Int) -> ((Int) -> Bool){ {$0<i} }
prefix func ~<=(_ i:Int) -> ((Int) -> Bool){ {$0<=i} }

public extension Int{
    
    var string:String{
        String(self)
    }
    
    static func ~= (pattern:(Int) -> Bool,value:Int) -> Bool{
        pattern(value)
    }
    
    func test(){
        let i = 10
        switch i {
        case ~>=0:
            print("大于等于0")
        case ~>10:
            print("大于10")
        default:
            break
        }
    }
    
}
